package _11_整理题目._整理基础._OOM异常;

import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class _01_Java_Heap_Space {

    static class WuKong {}

    public static void main(String[] args) {
        test_liu();
    }

    public static void test_liu() {
        List<WuKong> list = new ArrayList<>();
        while (true) {
            list.add(new WuKong());
        }
    }

    @Test
    public void test_01() {
        ThreadGroup currentGroup =
                Thread.currentThread().getThreadGroup();
        int noThreads = currentGroup.activeCount();
        Thread[] lstThreads = new Thread[noThreads];
        currentGroup.enumerate(lstThreads);
        for (int i = 0; i < noThreads; i++)
            System.out.println("线程号：" + i + " = " + lstThreads[i].getName());
    }

}
